package ticketonline.entity;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cascade;


@Entity
@Table(name="TB_BookingHeader")
public class BookingHeader {
	@Id
	@Column(name="booking_id", length=10, nullable=false)
	private String bookingNo;
	
	@Column(name="booking_date", nullable=false)
        @Temporal(TemporalType.TIMESTAMP)
	private Date bookingDate;
	
	@ManyToOne
        @JoinColumn(name="cust_id")
	private Customer Customer;
	
	@Column(name="total")
	private BigDecimal priceTotal;
	
	@OneToMany(mappedBy="bookingHeader")
	@Cascade(value=org.hibernate.annotations.CascadeType.ALL)
	private List<BookingDetail> BookingDetail;

	public String getBookingNo() {
		return bookingNo;
	}

	public void setBookingNo(String bookingNo) {
		this.bookingNo = bookingNo;
	}

	public Date getBookingDate() {
		return bookingDate;
	}

	public void setBookingDate(Date bookingDate) {
		this.bookingDate = bookingDate;
	}

	public Customer getCustomer() {
		return Customer;
	}

	public void setCustomer(Customer customer) {
		Customer = customer;
	}

	public BigDecimal getPriceTotal() {
		return priceTotal;
	}

	public void setPriceTotal(BigDecimal priceTotal) {
		this.priceTotal = priceTotal;
	}

	@Override
	public String toString() {
		return "BookingHeader [bookingNo=" + bookingNo + ", bookingDate="
				+ bookingDate + ", Customer=" + Customer + ", priceTotal="
				+ priceTotal + "]";
	}

	public List<BookingDetail> getBookingDetail() {
		return BookingDetail;
	}

	public void setBookingDetail(List<BookingDetail> bookingDetail) {
		BookingDetail = bookingDetail;
	}
	
}